﻿using System;
using JoceLinItemDemo.Domain;
using Microsoft.Extensions.DependencyInjection;
using Volo.Abp.EntityFrameworkCore;
using Volo.Abp.Modularity;

namespace JoceLinItemDemo.EntityFrameworkCore
{
    [DependsOn(typeof(AbpEntityFrameworkCoreModule),typeof(DemoDomainModule))]
    public class DemoEntityFrameworkCoreModule:AbpModule
    {
        public override void ConfigureServices(ServiceConfigurationContext context)
        {
            var services = context.Services;
            //注册上下文类到IOC
            services.AddAbpDbContext<MyContext>(opt => {
                opt.AddDefaultRepositories(true); // 启用ABP仓储 注意，要在主入口项目中使用Autoface
            });

            Configure<AbpDbContextOptions>(opt => {
                opt.UseSqlServer();  // 数据库使用的是SQL Server
            });
        }
    }
}
